{% extends "socialaccount/base.html" %}

{% load i18n %}
{% load bootstrap_tags %}
{% load socialaccount_extra %}

{% block title %}{% trans "Account Connections" %}{% endblock %}

{% block body_outer %}
<h1>{% trans "Account Connections" %}</h1>

{% if form.accounts %}
<p>{% blocktrans %}You can sign in to your account using any of the following already connected third party accounts:{% endblocktrans %}</p>


<form method="post" action="{% url 'socialaccount_connections' %}">
  {% csrf_token %}
  {% if form.non_field_errors %}
    <div id="errorMsg">{{ form.non_field_errors }}</div>
  {% endif %}

  {% for base_account in form.accounts %}
    {% with base_account.get_provider_account as account %}
      <div class="form-group">
        <label for="id_account_{{ base_account.id }}"></label>
        <input id="id_account_{{ base_account.id }}" type="radio" name="account" value="{{ base_account.id }}"/>
        <i class="fa fa-{{ account.get_brand.name|lower }}-square fa-2x" aria-hidden="true"></i> {{ account.get_brand.name }} account: {{ account }}
      </div>
    {% endwith %}
  {% endfor %}

  <div>
    <button type="submit">{% trans 'Remove' %}</button>
  </div>

</form>

{% else %}
<p>{% trans 'You currently have no social network accounts connected to this account.' %}</p>
{% endif %}

{% get_number_unconnected_providers user as unconnected_providers %}

{% if unconnected_providers > 0 %}

<h3>{% trans 'Add a 3rd Party Account' %}</h3>

<div class="row">
  {% include "socialaccount/snippets/remaining_providers_list.html" with process="connect" %}
</div>

{% include "socialaccount/snippets/login_extra.html" %}

{% endif %}

{% endblock %}
